<template>
  <div class="cont">
    {{ props.msgs[state.inx]||'' }}
  </div>
</template>

<script setup>
const props = defineProps({
  msgs: {
    type:Array,
    default:[]
  }
});
const state = reactive({
  msg: '',
  inx: -1,
  tm: null,
})
const emit = defineEmits(["close"]);
const show = () => {
  if (props.msgs.length > 0) {
    state.inx++
    if (state.inx >= props.msgs.length) {
      state.inx=0;
    }
    //state.msg = props.msgs[state.inx]
  }
  setTimeout(() => {
    show()
  }, 5000);
}
onMounted(() => {
  show()
})
onUnmounted(() => {
  clearTimeout(state.tm)
})
</script>

<style lang="scss" scoped>
.cont {
  width: 460px;
  height: 44px;
  background-image: url('/images/note.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 500;
  font-size: 14px;
  color: #FFFFFF;
}

.dia {
  margin-top: 5px;
  width: 1200px;
  height: 712px;
  display: flex;
  flex-direction: column;
  background-image: url('/images/bgd.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;

  .header {
    width: 1200px;
    height: 32px;
    display: flex;
    align-items: center;

    .title {
      margin-left: 30px;
      font-weight: 600;
      font-size: 14px;
      color: #FFFFFF;
    }

    .close {
      margin: 8px 2px 0 auto;
      background-image: url('/images/close.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      width: 30px;
      height: 30px;
      cursor: pointer;
      opacity: 0.5;
    }
  }

  .content {
    width: 1200px;
    height: 680px;
    padding: 1px;
  }
}
</style>